package cn.explink.dop.controller;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.explink.dop.enums.OrderPayMethodEnum;
import cn.explink.dop.enums.OrderStatusEnum;
import cn.explink.dop.enums.pub.YesNoEnum;
import cn.explink.eap.core.common.model.json.AjaxJson;
import cn.explink.eap.web.cgform.controller.autolist.CgAutoListController;

/**
 *
 * @author songkaojun
 */
@Controller
@RequestMapping("/orderEnumController")
public class OrderEnumController extends CgAutoListController {

	@RequestMapping(params = "getOrderStatus")
	@ResponseBody
	public AjaxJson getOrderStatus(HttpServletRequest request) {
		AjaxJson ajaxJson = new AjaxJson();
		Map<String, Object> map = new LinkedHashMap<String, Object>();
		map.put(1 + "", OrderStatusEnum.getTextByValue(1));
		for (OrderStatusEnum orderStatusEnum : OrderStatusEnum.getAllStatus()) {
			map.put(orderStatusEnum.getValue() + "", orderStatusEnum.getText());
		}
		ajaxJson.setAttributes(map);
		return ajaxJson;
	}

	@RequestMapping(params = "getPayMethod")
	@ResponseBody
	public AjaxJson getPayMethod(HttpServletRequest request) {
		AjaxJson ajaxJson = new AjaxJson();
		Map<String, Object> map = new HashMap<String, Object>();
		for (OrderPayMethodEnum orderPayMethodEnum : OrderPayMethodEnum.getAllStatus()) {
			map.put(orderPayMethodEnum.getValue() + "", orderPayMethodEnum.getText());
		}
		ajaxJson.setAttributes(map);
		return ajaxJson;
	}

	@RequestMapping(params = "getNeedWarmBox")
	@ResponseBody
	public AjaxJson getNeedWarmBox(HttpServletRequest request) {
		AjaxJson ajaxJson = new AjaxJson();
		Map<String, Object> map = new HashMap<String, Object>();
		for (YesNoEnum yesNoEnum : YesNoEnum.getAllStatus()) {
			map.put(yesNoEnum.getValue() + "", yesNoEnum.getText());
		}
		ajaxJson.setAttributes(map);
		return ajaxJson;
	}
}
